{include file="public/header" /}


<div class="page">
    <div class="explanation" id="explanation">
        <div class="title" id="checkZoom">
            <h4 title="{$Think.lang.ds_explanation_tip}">{$Think.lang.ds_explanation}</h4>
            <span id="explanationZoom" title="{$Think.lang.ds_explanation_close}" class="arrow"></span>
        </div>
        <ul>
            <li>{$Think.lang.ownshop_edit_help1}</li>
            <li>{$Think.lang.ownshop_edit_help2}</li>
            <li>{$Think.lang.ownshop_edit_help3}</li>
            <li>{$Think.lang.ownshop_edit_help4}</li>
        </ul>
    </div>
    <form id="store_form" method="post">
        <input type="hidden" name="store_id" value="{$store_array.store_id}" />
        <table class="ds-default-table">
            <tbody>
                <tr class="noborder">
                    <td class="required w120"><label class="validation" for="store_name">{$Think.lang.ds_store_name}:</label></td>
                    <td class="vatop rowform"><input type="text" value="{$store_array.store_name}" id="store_name" name="store_name" class="txt" /></td>
                    <td class="vatop tips"></td>
                </tr>
                <tr class="noborder">
                    <td class="required"><label for="store_name">{$Think.lang.store_addtime}:</label></td>
                    <td class="vatop rowform">{notempty name="$store_array.store_addtime"}{$store_array.store_addtime|date='Y-m-d'}{/notempty}</td>
                    <td class="vatop tips"></td>
                </tr>
                <tr class="noborder">
                    <td class="required"><label>{$Think.lang.ds_member_name}:</label></td>
                    <td class="vatop rowform">{$store_array.member_name}</td>
                    <td class="vatop tips"></td>
                </tr>
                <tr class="noborder">
                    <td class="required"><label class="validation" for="seller_name">{$Think.lang.ds_seller_name}:</label></td>
                    <td class="vatop rowform">{$store_array.seller_name}</td>
                    <td class="vatop tips">{$Think.lang.seller_name_tips}</td>
                </tr>
            </tbody>
            <tbody>
                <tr class="noborder">
                    <td class="required"><label><label>{$Think.lang.belongs_class}:</label></label></td>
                    <td class="vatop rowform">
                        <select name="storeclass_id">
                              <option value="0">{$Think.lang.ds_please_choose}...</option>
                              {notempty name="class_list"}
                              {foreach name="class_list" item="v" key="k" }
                              <option {if $store_array.storeclass_id == $v.storeclass_id}selected="selected" {/if} value="{$v.storeclass_id}">{$v.storeclass_name}</option>
                              {/foreach}
                              {/notempty}
                          </select>
                    </td>
                    <td class="vatop tips"></td>
                </tr>
            </tbody>
            <tbody>
                <tr class="noborder">
                    <td class="required"><label><label for="bind_all_gc">{$Think.lang.bind_all_gc}:</label></label></td>
                    <td class="vatop rowform onoff">
                        <label for="bind_all_gc1" class="cb-enable {if $store_array.bind_all_gc == '1'}selected{/if}" ><span>{$Think.lang.ds_yes}</span></label>
                        <label for="bind_all_gc0" class="cb-disable {if $store_array.bind_all_gc == '0'}selected{/if}" ><span>{$Think.lang.ds_no}</span></label>
                        <input id="bind_all_gc1" name="bind_all_gc" {if $store_array.bind_all_gc == '1'}checked="checked"{/if} value="1" type="radio">
                        <input id="bind_all_gc0" name="bind_all_gc" {if $store_array.bind_all_gc == '0'}checked="checked"{/if} value="0" type="radio">
                    </td>
                    <td class="vatop tips"></td>
                </tr>
            </tbody>
            <tbody>
                <tr class="noborder">
                    <td class="required"><label><label for="state">{$Think.lang.store_state}:</label></label></td>
                    <td class="vatop rowform onoff"><label for="store_state1" class="cb-enable {if $store_array.store_state == '1'}selected{/if}" ><span>{$Think.lang.ds_open}</span></label>
                        <label for="store_state0" class="cb-disable {if $store_array.store_state == '0'}selected{/if}" ><span>{$Think.lang.ds_close}</span></label>
                        <input id="store_state1" name="store_state" {if $store_array.store_state == '1'}checked="checked"{/if} onclick="$('#tr_store_close_info').hide();" value="1" type="radio">
                        <input id="store_state0" name="store_state" {if $store_array.store_state == '0'}checked="checked"{/if} onclick="$('#tr_store_close_info').show();" value="0" type="radio">
                    </td>
                    <td class="vatop tips"></td>
                </tr>
            </tbody>
            <tbody id="tr_store_close_info">
                <tr >
                    
                </tr>
                <tr class="noborder">
                    <td class="required"><label for="store_close_info">{$Think.lang.store_close_info}:</label></td>
                    <td class="vatop rowform"><textarea name="store_close_info" rows="6" class="tarea" id="store_close_info">{$store_array.store_close_info}</textarea></td>
                    <td class="vatop tips"></td>
                </tr>
            </tbody>
            <tfoot>
                <tr class="tfoot">
                    <td colspan="15"><input class="btn" type="submit" value="{$Think.lang.ds_submit}"/></td>
                </tr>
            </tfoot>
        </table>
    </form>
</div>
<script type="text/javascript">
    $(function () {

        $('input[name=store_state][value={$store_array.store_state}]').trigger('click');
        $('#store_form').validate({
            errorPlacement: function (error, element) {
                error.appendTo(element.parentsUntil('tr').parent().find('td:last'));
            },
            rules: {
                store_name: {
                    required: true,
                    remote: "{:url('Ownshop/ckeck_store_name',['store_id'=>$store_array.store_id])}"
                }
            },
            messages: {
                store_name: {
                    required: '{$Think.lang.store_name_required}',
                    remote: '{$Think.lang.store_name_remote}'
                }
            }
        });
    });
</script>
